// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout , PageView } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}
export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: 'menu.home' },
    redirect: '/mall/goodsOrder/order',
    children: [
      {
        path: '/newMall',
        name: 'newMall',
        redirect: '/newMall/goods',
        component: BlankLayout,
        meta: { title: '商品管理' , keepAlive: false, icon: 'shopping', permission: ['updateClassify','updateGoodsCommonConfig','updateGoodsDetail','updateGoodsGeneral','updateRiderUserInfo','upadteGoodsLists','queryGoodsStorehouseBindConfigByUserid','queryGoodsPurchaseForm']},
        children: [
          {
            path: '/newMall/classify',
            name: 'newMallClassify',
            hidden: true,
            component: () => import('@/views/newMall/classify'),
            meta: { title: '商品分类' , keepAlive: false, permission: ['queryClassify','updateClassify']}
          },
          // {
          //   path: '/newMall/specification',
          //   name: 'newMallSpecification',
          //   component: () => import('@/views/newMall/specification'),
          //   meta: { title: '商品公共信息配置' , keepAlive: false, permission: ['updateGoodsCommonConfig']}
          // },
          // {
          //   path: '/newMall/warehouse',
          //   name: 'newMallWarehouse',
          //   component: () => import('@/views/newMall/warehouse'),
          //   meta: { title: '商品仓库客服绑定' , keepAlive: false, permission: ['updateGoodsStorehouseBindConfig']}
          // },
          {
            path: '/newMall/zone',
            name: 'newMallZone',
            hidden: true,
            component: () => import('@/views/newMall/specification/zone'),
            meta: { title: '商品分区' , keepAlive: false, permission: ['updateGoodsArea']}
          },
          {
            path: '/newMall/goodDetail',
            name: 'newMallGoodDetail',
            hidden: true,
            component: () => import('@/views/newMall/goods/goodsDetail'),
            meta: { title: '商品配置' , keepAlive: false, permission: ['updateGoodsDetail']}
          },
          {
            path: '/newMall/goods',
            name: 'newMallGoods',
            hidden: true,
            component: () => import('@/views/newMall/goods/goodsGeneral'),
            meta: { title: '商品配置' , keepAlive: false, permission: ['updateGoodsGeneral']}
          },
          {
            path: '/newMall/goodLists',
            name: 'newMallGoodLists',
            hidden: true,
            component: () => import('@/views/newMall/goods/goodLists'),
            meta: { title: '商品上架' , keepAlive: false, permission: ['upadteGoodsLists']}
          },
          {
            path: '/newMall/goodsWarehouse',
            name: 'newMallGoodsWarehouse',
            component: () => import('@/views/newMall/goods/goodsWarehouse'),
            meta: { title: '仓库上架' , keepAlive: false, permission: ['queryGoodsStorehouseBindConfigByUserid']}
          },
          {
            path: '/newMall/purchaseOrder',
            name: 'newMallPurchaseOrder',
            hidden: true,
            component: () => import('@/views/newMall/goods/purchaseOrder'),
            meta: { title: '上单表' , keepAlive: false, permission: ['queryGoodsPurchaseForm']}
          },
          {
            path: '/newMall/purchaseOrderStatisDate',
            name: 'newMallPurchaseOrderStatisDate',
            hidden: true,
            component: () => import('@/views/newMall/goods/purchaseOrder/statisDate'),
            meta: { title: '上下单表统计日' , keepAlive: false, permission: ['queryGoodsPurchaseFormStatisticalDate']}
          },
          {
            path: '/newMall/purchase',
            name: 'newMallPurchase',
            hidden: true,
            component: () => import('@/views/newMall/goods/purchase'),
            meta: { title: '下单表' , keepAlive: false, permission: ['queryGoodsPurchaseForm']}
          },
        ]
      },
      {  //商城订单管理
        path: '/mall/goodsOrder',
        name: 'mallOrder',
        // hidden: true,
        redirect: '/mall/goodsOrder/order',
        component: PageView,
        meta: { title: '商城订单管理' , keepAlive: false, icon: 'schedule', permission: ['queryGoodsOrder','updateGoodsEvaluationConfig','updateGoodsPurchaseRecord','queryGoodsRiderAllOrder','checkGoodsOrderDeliveryUrgent']},
        children: [
          {
            path: '/mall/goodsOrder/order',
            name: 'mallGoodsOrder',
            component: () => import('@/views/mall/order'),
            meta: { title: '订单列表' , keepAlive: false, permission: ['queryGoodsOrder']}
          },
        ]
      },
      {
        path: '/brandManage',
        name: 'brandManage',
        redirect: '/brandManage/channelConfig',
        component: PageView,
        meta: { title: '运营管理' , keepAlive: false, icon: 'project', permission: ['updateBanner','updateBrandConfig','updateBrandChannelConfig','queryBrandAliWAPPayAccount','queryGoodsTimeConfig','updateGoodsTimeConfig','updateSuggestionsTagInfo','updateGoddsOrderAmountConfig']},
        children: [
          {
            path: '/brandManage/closeConfig',
            name: 'closeConfig',
            component: () => import('@/views/brandManage/closeConfig'),
            meta: { title: '打烊时间配置' , keepAlive: false, permission: ['updateGoodsCloseConfig',]}
          },
        ]
      },
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'riderLogin',
        name: 'riderLogin',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/LoginRiders')
      },
      // {
      //   path: 'register',
      //   name: 'register',
      //   component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      // },
      // {
      //   path: 'recover',
      //   name: 'recover',
      //   component: undefined
      // }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
